#!/bin/bash

rm -rf ../out-sbi
mkdir ../out-sbi

#export CROSS_COMPILE=riscv64-unknown-linux-gnu-
export CROSS_COMPILE=riscv64-buildroot-linux-gnu-
export PLATFORM=generic
export FW_TEXT_START=0x0
export FW_JUMP_ADDR=0x02000000
export FW_JUMP_FDT_ADDR=0x20000000
export FW_PIC=y
export BUILD_INFO=y
export DEBUG=1
make -j$(nproc) O=../out-sbi/

#make -j$(nproc) CROSS_COMPILE=riscv64-unknown-linux-gnu- PLATFORM=generic FW_TEXT_START=0x0 FW_JUMP_ADDR=0x02000000 FW_JUMP_FDT_ADDR=0x20000000 FW_PIC=y BUILD_INFO=y DEBUG=1 O=../out-sbi/

echo "output is ../out-sbi/platform/$PLATFORM/firmware/fw_dynamic.bin"
